5.3 Methods for Analysis and Processing of Discrete Biosignals

|

165

plot(tn,average_s,'LineWidth',2); hold on;

plot(tn,s, '--'); grid on;

legend('averaged', 'with noise')

xlabel('time t /s');

ylabel('amplitude');

axis([0 5 -1.2 1.2]);

subplot(4,2,4);

[S,f] = pwelch(average_s,[],[],[],fa);

plot(f,20*log(S),f,20*log(orig_S)); grid on;

legend('averaged', 'with noise')

xlabel('frequency f / Hz');

ylabel('amplitude / dB');

axis([0 10 -300 30]);

%% 50-fold coherent averaging of s

N = 50;

average_s=0;

for i=1:N

n=randn(size(x));

s=x+(a*n);

average_s=s/N+average_s;

SNR(i) = snr(average_s,fa,5,'aliased');

end

subplot(4,2,5);

plot(tn,average_s,'LineWidth',2); hold on;

plot(tn,s, '--'); grid on;

legend('averaged', 'with noise')

xlabel('time t /s');

ylabel('amplitude');

axis([0 5 -1.2 1.2]);

subplot(4,2,6);

[S,f]=pwelch(average_s,[],[],[],fa);

plot(f,20*log(S),f,20*log(orig_S)); grid on;

legend('averaged', 'with noise')

xlabel('frequency f / Hz');

ylabel('amplitude / dB');

axis([0 10 -300 30]);